/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * InputParamaterChooserPanel.java
 *
 * Created on May 17, 2011, 3:20:59 PM
 */

package jgaf.procedure;

import java.awt.Dimension;
import java.awt.Toolkit;

/**
 *
 * @author hanis
 */
public class InputParamaterChooserPanel extends javax.swing.JPanel {

    private ProcedureParameter parameter;

    
    public InputParamaterChooserPanel(ProcedureParameter parameter) {
        this.parameter = parameter;
        System.out.println("yeah");
        initComponents();
        initMyComponents();
        centerDialog();
    }



    private void initMyComponents() {
        parameterLabel.setText(parameter.getDescription());
        parameterText.setText("");
    }

    public void setParameter() {
        parameter.setText(parameterText.getText());
    }


    private void centerDialog() {
        Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
        int x = (int) ((dimension.getWidth() - this.getWidth()) / 2);
        int y = (int) ((dimension.getHeight() - this.getHeight()) / 2);
        this.setLocation(x, y);
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        parameterLabel = new javax.swing.JLabel();
        parameterText = new javax.swing.JTextField();

        parameterLabel.setText("jLabel1");

        parameterText.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                parameterTextActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(parameterLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(parameterText, javax.swing.GroupLayout.DEFAULT_SIZE, 476, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(parameterLabel)
                    .addComponent(parameterText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void parameterTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_parameterTextActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_parameterTextActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel parameterLabel;
    private javax.swing.JTextField parameterText;
    // End of variables declaration//GEN-END:variables

}
